f99b967990c9a0267589638de7817a28568dc252,src/main/java/com/microsoft/aad/adal4j/UserInfo.java,UserInfo,createFromIdTokenClaims,#ReadOnlyJWTClaimsSet#,94

Before Change


        } else if (!StringHelper.isBlank(claims.getStringClaim(AuthenticationConstants.ID_TOKEN_OBJECT_ID))) {
            userId = claims.getSubject();
        } else if (!StringHelper.isBlank(claims.getSubject())) {
            userId = claims.getSubject();
        }
        final UserInfo userInfo = new UserInfo(
                userId,
                claims.getStringClaim(AuthenticationConstants.ID_TOKEN_GIVEN_NAME),
                claims.getStringClaim(AuthenticationConstants.ID_TOKEN_FAMILY_NAME),
                claims.getStringClaim(AuthenticationConstants.ID_TOKEN_IDENTITY_PROVIDER),
                isDisplayable);

        return userInfo;

After Change


        return passwordExpiresOn;
    }

    static UserInfo createFromIdTokenClaims(final ReadOnlyJWTClaimsSet claims)
            throws java.text.ParseException {

        if (claims == null || claims.getAllClaims().size() == 0) {
            return null;
        }

        String uniqueId = null;
        String displayableId = null;

        if (!StringHelper.isBlank(claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_OBJECT_ID))) {
            uniqueId = claims
                    .getStringClaim(AuthenticationConstants.ID_TOKEN_OBJECT_ID);
        } else if (!StringHelper.isBlank(claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_SUBJECT))) {
            uniqueId = claims
                    .getStringClaim(AuthenticationConstants.ID_TOKEN_SUBJECT);
        }

        if (!StringHelper.isBlank(claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_UPN))) {
            displayableId = claims
                    .getStringClaim(AuthenticationConstants.ID_TOKEN_UPN);
        } else if (!StringHelper.isBlank(claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_EMAIL))) {
            displayableId = claims
                    .getStringClaim(AuthenticationConstants.ID_TOKEN_EMAIL);
        }

        final UserInfo userInfo = new UserInfo();
        userInfo.uniqueId = uniqueId;
        userInfo.dispayableId = displayableId;
        userInfo.familyName = claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_FAMILY_NAME);
        userInfo.givenName = claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_GIVEN_NAME);
        userInfo.identityProvider = claims
                .getStringClaim(AuthenticationConstants.ID_TOKEN_IDENTITY_PROVIDER);

        if (!StringHelper
                .isBlank(claims
                        .getStringClaim(AuthenticationConstants.ID_TOKEN_PASSWORD_CHANGE_URL))) {
            userInfo.passwordChangeUrl = claims
                    .getStringClaim(AuthenticationConstants.ID_TOKEN_PASSWORD_CHANGE_URL);
        }

        if (claims
                .getClaim(AuthenticationConstants.ID_TOKEN_PASSWORD_EXPIRES_ON) != null
                && (int) claims
                        .getClaim(AuthenticationConstants.ID_TOKEN_PASSWORD_EXPIRES_ON) > 0) {
            // pwd_exp returns seconds to expiration time
            // it returns in seconds. Date accepts milliseconds.
            Calendar expires = new GregorianCalendar();
            expires.add(
                    Calendar.SECOND,
                    (int) claims
                            .getClaim(AuthenticationConstants.ID_TOKEN_PASSWORD_EXPIRES_ON));
            userInfo.passwordExpiresOn = expires.getTime();
        }